#include <dao.h>
#include <btBulletDynamicsCommon.h>

#include "btRigidBodyConstructionInfo.h"

static void construct(DaoContext *ctx, DValue *p[], int N) {
    float		mass = p[0]->v.f;
    btMotionState	*motion = (btMotionState*) DaoCData_GetData(p[1]->v.cdata);
    btCollisionShape	*collisionShape = (btCollisionShape*) DaoCData_GetData(p[2]->v.cdata);
    btVector3		*localInertia = (btVector3*) DaoCData_GetData(p[3]->v.cdata);

    btRigidBody::btRigidBodyConstructionInfo* ptr = new btRigidBody::btRigidBodyConstructionInfo(mass, motion, collisionShape, *localInertia);

    DaoCData *cdata = DaoContext_PutCData(ctx, ptr, &btRigidBodyConstructionInfoTyper);
};

static void destruct(void *self) {
    delete (btRigidBody::btRigidBodyConstructionInfo*) self;
}

static DaoFuncItem meth[] = {
    { construct,	"btRigidBodyConstructionInfo(mass:float, motion:btMotionState, collisionShape:btCollisionShape, localInertia:btVector3)" },
    { NULL, NULL }
};

DaoTypeBase btRigidBodyConstructionInfoTyper = {
    "btRigidBodyConstructionInfo",
    NULL,
    NULL,               /* constant */
    meth,       	/* methods */
    { NULL },     	/* parent type */
    { NULL },
    destruct,
    NULL
};
